import 'package:fget_file/file_model_entity.dart';

fileModelEntityFromJson(FileModelEntity data, Map<String, dynamic> json) {
	if (json['data'] != null) {
		data.data = (json['data'] as List).map((v) => FileModelData().fromJson(v)).toList();
	}
	return data;
}

Map<String, dynamic> fileModelEntityToJson(FileModelEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['data'] =  entity.data?.map((v) => v.toJson())?.toList();
	return data;
}

fileModelDataFromJson(FileModelData data, Map<String, dynamic> json) {
	if (json['fileDate'] != null) {
		data.fileDate = json['fileDate'].toString();
	}
	if (json['fileName'] != null) {
		data.fileName = json['fileName'].toString();
	}
	if (json['filePath'] != null) {
		data.filePath = json['filePath'].toString();
	}
	if (json['fileSize'] != null) {
		data.fileSize = json['fileSize'].toString();
	}
	return data;
}

Map<String, dynamic> fileModelDataToJson(FileModelData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['fileDate'] = entity.fileDate;
	data['fileName'] = entity.fileName;
	data['filePath'] = entity.filePath;
	data['fileSize'] = entity.fileSize;
	return data;
}